<style>
    .fsh-rightPanel {
        background: white;
    }


</style>
<div class="fsh-rightPanel">
<!--    <div class="layui-breadcrumb" style="visibility: visible">-->
<!--        <a href="./../">首页</a>-->
<!--        <span lay-separator>/</span>-->
<!--        <a href="../">国际新闻</a>-->
<!--        <span lay-separator>/</span>-->
<!--        <a><cite>亚太地区</cite></a>-->
<!--    </div>-->
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
        <legend>直播设置</legend>
    </fieldset>

    <div class="layui-form" style="width: 500px">
        <div class="layui-form-item">
            <label class="layui-form-label">推流地址</label>
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-normal" id="generateLiveParam">获取推流参数</button>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">推流地址</label>
            <div class="layui-input-block">
                <input type="text" placeholder="点击按钮生成" disabled class="layui-input" id="rtmp-url">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">推流秘钥</label>
            <div class="layui-input-block">
                <input type="text" placeholder="点击按钮生成" disabled class="layui-input" id="rtmp-key">
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-normal" id="startLive">开始直播</button>
                <button class="layui-btn layui-btn-warm" id="stopLive">停止直播</button>
            </div>
        </div>
    </div>
</div>


<script>
    var id = getHashParam().id;
    //获取数据
    var pageSize = 20;
    layui.use(['layer', 'form', 'element'], function () {
        var layer = layui.layer;
        var form = layui.form;
        var element = layui.element;
        //新增课件
        $('#generateLiveParam').click(function () {
            generateLiveParam();
        });

    });


    function generateLiveParam() {
        $.ajax({
            url: context + '/api/live/getPushParam?course_id=' + id,
            type:'GET',
            success: function (result) {
                if (result.success) {
                    $('#rtmp-url').val(result.data.server);
                    $('#rtmp-key').val(result.data.key);
                } else {
                    layer.msg(result.msg);
                }
            }
        });

    }


</script>

